#include <iostream>
#include <stack>
#include <string>
using namespace std;

const int N = 1e9 + 10;
stack<int> st;
char ch;
int num = 0;

int main()
{
   while(cin >> ch)
   {
    if(ch == '@') break;
    else if(ch >= '0' && ch <= '9')
        num = num * 10 + ch - '0'; 
    else if(ch == '.') 
    {
        st.push(num);
        num = 0;
    }
    else
    {
        int a = st.top(); st.pop();
        int b = st.top(); st.pop();
        if(ch == '+') st.push(b + a);
        else if(ch == '-') st.push(b - a);
        else if(ch == '*') st.push(b*a);
        else st.push(b/a);
    }

   } 
   cout << st.top() << endl;

    return 0;
}

